<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="系列管理">
<style>
    .button-large {
        font-size: 16px;
    }

    .webuploader-pick {
        background: none;
        padding: 0;
    }

    input.calendar {
        width: 160px;
    }
</style>
<div class="xm-product">
    <div class="row">
        <div class="panel">
            <div class="panel-header">
                <a href="${basepath}/rest/manage/productcategory/toList">返回上一级</a>
            </div>
            <div class="panel-body">
                <form id="addForm" class="form-horizontal" action="${basepath}/rest/manage/productcategory/insertJson"
                      method="post">
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            系列名称：
                        </label>
                        <div class="controls">

                            <input type="text" class="control-text span-width span8" name="name" placeholder="请输入名称"
                                   data-rules="{required : true}">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            系列简介：
                        </label>

                        <div class="controls  control-row-auto">
                            <textarea name="introduce"  class="control-row4 input-large" data-rules="{required : true}" placeholder="请输入内容"></textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            首页图标：
                        </label>
                        <div class="controls">
                            <input type="text" class="input-normal control-text " name="icon"
                                   data-rules="{required : true}" readonly style="width: 280px;">
                            <div class="pull-right">
                                <a id="icon" class="button button-min button-primary"
                                   style="height:20px;margin-left: 10px;">上传</a>
                                <span style="padding: 1rem ">推荐尺寸48*48</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            图标(激活)：
                        </label>
                        <div class="controls">
                            <input type="text" class="input-normal control-text " name="iconClick"
                                   data-rules="{required : true}" readonly style="width: 280px;">
                            <div class="pull-right">
                                <a id="iconClick" class="button button-min button-primary "
                                   style="height:20px;margin-left: 10px;">上传</a>
                                <span style="padding: 1rem ">推荐尺寸48*48</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            系列封面：
                        </label>
                        <div class="controls">
                            <input type="text" class="input-normal control-text " name="background"
                                   data-rules="{required : true}" readonly style="width: 280px;">
                            <div class="pull-right">
                                <a id="background" class="button button-min button-primary"
                                   style="height:20px;margin-left: 10px;">上传</a>
                                <span style="padding: 1rem ">推荐尺寸228*228</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            系列头图：
                        </label>

                        <div class="controls">
                            <input type="text" class="input-normal control-text " name="headImage"
                                   data-rules="{required : true}" readonly style="width: 280px;">
                            <div class="pull-right">
                                <a id="headImage" class="button button-min button-primary "
                                   style="height:20px;margin-left: 10px;">上传</a>
                                <span style="padding: 1rem ">推荐尺寸1920*420</span>
                            </div>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            软件功能：
                        </label>

                        <div class="controls control-row12" style="height: 350px;initialFrameWidth: 100%;">
                            <textarea type="text" class="input-large ueditBox" name="functionIntroduce" id="power"
                                      data-rules="{required:true}"></textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            二次开发：
                        </label>

                        <div class="controls control-row12" style="height: 350px;initialFrameWidth: 100%;">
                            <textarea type="text" class="input-large ueditBox" name="developIntroduce" id="second"
                                      data-rules="{required:true}"></textarea>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">
                            <s>*</s>
                            模块集成：
                        </label>

                        <div class="controls control-row12" style="height: 350px;initialFrameWidth: 100%;">
                            <textarea type="text" class="input-large ueditBox" name="moduleIntroduce" id="extend"
                                      data-rules="{required:true}"></textarea>
                        </div>
                    </div>
                    <div class="centered">
                        <button type="submit" class="button  button-large  button-success">保存</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    var ue = UE.getEditor('power', {

        initialFrameWidth :800,
       initialFrameHeight:200,
    });
    var ue2 = UE.getEditor('second', {

        initialFrameWidth :800,
       initialFrameHeight:200,
    });
    var ue3 = UE.getEditor('extend', {

        initialFrameWidth :800,
       initialFrameHeight:200,
    });
    var addForm = new BUI.Form.Form({
        srcNode: '#addForm',
        submitType: 'ajax',
        callback: function (data) {
            if (data.success == true) {
                window.location.href = "${basepath}/rest/manage/productcategory/toList"
            } else {
                BUI.Message.Alert(data.message, 'error');
                return;
            }
        }
    }).render();

    /*------------------------店铺头像上传插件配置  begin-----------------------*/
    //商品主图上传
    var pictureUploader = WebUploader.create({
        auto: true,
        swf: '${staticpath}/base/ueditor/third-party/webuploader/Uploader.swf',
        server: '${basepath}/rest/manage/ued/config?action=uploadimage',
        pick: '#icon',
        resize: false,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/gif,image/jpg,image/jpeg,image/bmp,image/png,'
        }
    });
    //获取一张主图并传入url
    pictureUploader.on('uploadSuccess', function (file, response) {
        pictureUploader.removeFile(file);
        addForm.setFieldValue("icon",  response.url)
    });
    /*------------------------店铺头像上传插件配置  begin-----------------------*/
    //商品主图上传
    var iconClickUploader = WebUploader.create({
        auto: true,
        swf: '${staticpath}/base/ueditor/third-party/webuploader/Uploader.swf',
        server: '${basepath}/rest/manage/ued/config?action=uploadimage',
        pick: '#iconClick',
        resize: false,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/gif,image/jpg,image/jpeg,image/bmp,image/png,'
        }
    });
    //获取一张主图并传入url
    iconClickUploader.on('uploadSuccess', function (file, response) {
        iconClickUploader.removeFile(file);
        addForm.setFieldValue("iconClick",  response.url)
    });

    /*------------------------店铺背景图上传插件配置  begin-----------------------*/
    //商品主图上传
    var backUploader = WebUploader.create({
        auto: true,
        swf: '${staticpath}/base/ueditor/third-party/webuploader/Uploader.swf',
        server: '${basepath}/rest/manage/ued/config?action=uploadimage',
        pick: '#background',
        resize: false,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/gif,image/jpg,image/jpeg,image/bmp,image/png,'
        }
    });
    //获取一张主图并传入url
    backUploader.on('uploadSuccess', function (file, response) {
        backUploader.removeFile(file);
        addForm.setFieldValue("background", response.url)
    });
    /*------------------------店铺背景图上传插件配置  begin-----------------------*/
    //商品主图上传
    var backUploader = WebUploader.create({
        auto: true,
        swf: '${staticpath}/base/ueditor/third-party/webuploader/Uploader.swf',
        server: '${basepath}/rest/manage/ued/config?action=uploadimage',
        pick: '#headImage',
        resize: false,
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/gif,image/jpg,image/jpeg,image/bmp,image/png,'
        }
    });
    //获取一张主图并传入url
    backUploader.on('uploadSuccess', function (file, response) {
        backUploader.removeFile(file);
        addForm.setFieldValue("headImage", response.url)
    });


</script>

</@page.pageBase>
